//index.js
//获取应用实例
const app = getApp()
var appData = app.globalData
Page({
    data: {
        user_id: null,
    },
    onLoad: function (options) {
        console.log(options)
        this.user_id = options.user_id
    },
    // 创建圈子
    create: function () {
        // 请求接口
        let user_id = this.user_id
        wx.request({
            url: appData.apiUrl + 'user/addgroup',
            data: {
                user_id: user_id
            },
            success: function (res) {
                console.log(res)
                if (res.data.status == true) {
                    // 创建圈子成功
                    app.globalData.group = res.data.data
                    let group_id = res.data.data.id
                    // 跳转到圈子页面
                    wx.navigateTo({
                        url: '/pages/lingGroup/lingGroup?user_id=' + user_id + '&group_id=' + group_id
                    })
                }
            }
        })
    }
})
